
import React from 'react'
import { Link } from 'react-router-dom'
import api from '@/api'
import { 
  Row,
  Button,
} from 'antd'
export default class Log_id extends React.Component {
  constructor(props){
    super(props)
    this.state = {
      log: {},
      page: {
        title: '操作日志详情'
      },
      saving: false,
      isNew: false,
      form: {
        name: '',
        total: '',
        expired_at: '1',
        outdate_day: ''
      }
    }
  }
  componentWillMount(){
    // this.props.match.params.id
    // this.$route.params.id
    api.log_detail(this.props.match.params.id).then(({ data }) => {
      if (data.status === 'success') {
        this.setState({log: data.data.log})
      }
    })
  }
  render(){
    const { page, log} = this.state 
    return(
      <div>
        <Row className="mariya-filter-form">
          <div className="mariya-filter-form__title">{page.title }</div>
          <div className="mariya-filter-form__group">
            <Link to="/log">
              <Button type="default" icon="el-icon-back">返回</Button>
            </Link>
          </div>
        </Row>
        <Row className="mariya-table">
          <Row className="mariya-table__entity">
            <table>
              <tbody>
                <tr>
                  <td className="label" width="200">IP</td>
                  <td className="con"> {log.ip}</td>
                </tr>
                <tr>
                  <td className="label">账户</td>
                  <td className="con"> {log.administrator_name}</td>
                </tr>
                <tr>
                  <td className="label">操作类型</td>
                  <td className="con">{log.event}</td>
                </tr>
                <tr>
                  <td className="label">控制器</td>
                  <td className="con">{log.action}</td>
                </tr>
                <tr>
                  <td className="label">操作时间</td>
                  <td className="con">{log.created_at}</td>
                </tr>
              </tbody>
            </table>
          </Row>
        </Row>
      </div>
    )
  }  
}
